interface IPageData {
  SDKVersion?: string;
  myCoin: number;
  isSign: boolean;
  message_time: number;
}

interface IPageMethods {
  SignIn(): void;
}

Page({
  data: {
    SDKVersion: "",
    myCoin: 33,
    isSign: false,
    message_time: 3,
    bubbleList: [
      {
        title: "支付成功",
        colorType: 1,
        top: 65,
        left: 74,
      },
      {
        title: "支付成功",
        colorType: 1,
        top: -7,
        left: 99,
      },
      {
        title: "运动步数",
        colorType: 1,
        top: 7,
        left: 132,
      },
      {
        title: "新人专享",
        colorType: 2,
        top: -7,
        left: 165,
      },
      {
        title: "运动步数",
        colorType: 1,
        top: 65,
        left: 197,
      },
    ],
    rent_recommend: [
      {
        cover: 'https://img1.rrzuji.cn/uploads/scheme/2104/30/o/bqlLRHz608babbb704d5.jpg',
        id: 1,
        title: '顶配iPhone 15 Pro Max 256GB',
        tags: '免押金',
        price: 8.51,
        type: 1,
        day: 30
      },
      {
        cover: 'https://img1.rrzuji.cn/uploads/scheme/2210/31/m/0qF4gMW1XftXmKraBF7z.jpg',
        id: 2,
        title: '顶配iPhone 15 Pro Max 256GB',
        tags: '免押金',
        price: 2.99,
        type: 1,
        day: 30
      },
      {
        cover: 'https://img1.rrzuji.cn/uploads/scheme/2107/14/m/oxSB4g960eeb3f2abec0.jpg',
        id: 3,
        title: '顶配iPhone 15 Pro Max 256GB',
        tags: '免押金',
        price: 4.97,
        type: 1,
        day: 30
      },
      {
        cover: 'https://img-t1.rrzuji.cn/assest/202008/SUPER5F2ABD087015A.png',
        id: 4,
        title: '顶配iPhone 15 Pro Max 256GB',
        tags: '免押金',
        price: 6.38,
        type: 1,
        day: 30
      },
    ]
  },
  // 签到
  SignIn() {
    if (!this.data.isSign) {
      console.log("签到成功");
      this.setData({ isSign: true });
      my.showToast({
        content: "签到成功", // 提示内容
        duration: 2000, // 显示时长（毫秒，默认 2000）
      });
    }
  },
  // 加载更多数据
  getMore() {
    const newData = [...this.data.rent_recommend, ...this.data.rent_recommend];
    this.setData({ rent_recommend: newData });
  },
  // handleClick 租币当钱花跳转
  handleClick(e) {
    const { index } = e.currentTarget.dataset;
    if (index === 0) {
      my.navigateTo({
        url: "/pages/mall/mall",
      });
    }else if (index === 1) {
      my.navigateTo({
        url: "/pages/task/task",
      });
    }
  },

  handleMessage() {
    my.navigateTo({
        url: "/pages/message/message",
    });
  },
  // onLoad(query) {
  //   // 页面加载
  //   console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
  // },
  // onReady() {
  //   // 页面加载完成
  // },
  // onShow() {
  //   // 页面显示
  //   this.setData({
  //     SDKVersion: my.SDKVersion,
  //   });
  // },
  // onUnload() {
  //   // 页面被关闭
  // },
  // onTitleClick() {
  //   // 标题被点击
  // },
  // onPullDownRefresh() {
  //   // 页面被下拉
  // },
  // onReachBottom() {
  //   // 页面被拉到底部
  // },
  // onShareAppMessage() {
  //   // 返回自定义分享信息
  //   return {
  //     title: "My App",
  //     desc: "My App description",
  //     path: "pages/index/index",
  //   };
  // },
});
